<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>

<jsp:include page="/WEB-INF/common/menu/ADMIN_LEFT_MENU.html" flush="false"/>

<div class="span9" id="content">
	<!-- block -->
	<div class="block">
		<div class="navbar navbar-inner block-header">
			<div class="muted pull-left">상세조회</div>
		</div>
		<div class="block-content collapse in">
			<div class="span12">
				<form class="form-horizontal" action="./editProcess.do" method="post" id="frmSave">
					<input name="menu_seq" value="${param.menu_seq }" type="hidden" />
					<input name="fq_seq" value="${map.fq_seq}" type="hidden" />
					<fieldset>
						<div class="control-group">
							<label class="control-label" for="title">질문</label>
							<div class="controls">
								<input type="text" name="title" class="span8" id="title" value="${map.title }">
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="editor">답변</label>
							<div class="controls">
	                            <textarea id="editor" name="content" style="height:300px;">${map.content }</textarea>
							</div>
						</div>
						<div class="form-actions">
							<button onclick="save();return false;" class="btn btn-primary">저장</button>
							<button onclick="location.href='./faqList.do?_=1${_page.prameter }';return false;" class="btn">목록</button>
							<c:if test="${!empty map.fq_seq && '' !=map.fq_seq }">
							<button onclick="deleteFaq();return false;" class="btn btn-danger">삭제</button>
							</c:if>
							
						</div>
					</fieldset>
				</form>

			</div>
		</div>
	</div>
</div>

<jsp:include page="/WEB-INF/jsp/pmgr/common/editor.jsp" flush="false"/>

<script type="text/javascript">
function save(){
	
	if($("#title").val()==''){
		alert("질문을 입력해주세요");
		$("#title").focus();
		return false;
	}

	if(__editor.getContent()==''){
		alert("답변을 입력해주세요");
// 		$("#content1").focus();
		return false;
	}
	if(confirm("저장하시겠습니까?")){
		$("#frmSave").submit();	
	}
}

//삭제
function deleteFaq(){
	if(confirm("삭제하시겠습니까?\n삭제한 데이터는 복구할수없습니다")){
		
		$("#frmSave").attr("action","./deleteProcess.do");
		$("#frmSave").submit();	
	}
}

</script>